<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path;
%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
<title>云校通-教师-课程列表</title>
<jsp:include page="/WEB-INF/page/common/_header.jsp"></jsp:include>
<body ontouchstart style="background: #FFFFFF;">
	<div class="weui_tab tab-bottom">
		<div class="weui-header bg-blue"> 
	  		<div class="weui-header-left"><a onclick="back()" href="javascript:;" class="icon icon-109 f-white">返回</a></div>
	    	<h1 class="weui-header-title">课程列表</h1>
		</div>
        <div class="weui_tab_bd">
		    <div class="weui_panel_bd" style="margin-bottom: 44px;">
			    <div class="weui_panel weui_panel_access mt0"  id="courseList">
			    	
			    </div>
			    <div class="dropload-down">
				    <div class="loadData dropload-hasData"></div>
				</div>
		     </div>
		     <a href="<%=basePath%>/ls/interest/course/addCourse">
                <div class="addBtnnew" id="addBtnnew">
					<div class="linea"></div>
					<div class="lineb"></div>
		        </div>
	         </a>
        </div>
   </div>
</body>
<jsp:include page="/WEB-INF/page/common/_footer.jsp"></jsp:include>
<script type="text/javascript">
	loadCourse();
	function loadCourse() {
		$.ajax({
			url: basePath + "/ls/interest/course/signCourseList",
			type: 'post',
			dataType: 'json',
			success: function(data) {
				var html = "";
				if(data.length == 0) {// 如果没有数据
            		 $('.loadData').removeClass("dropload-hasData").addClass("dropload-noData").html("暂时还没有课程");
                }
				for(var i in data) {
					var itm = data[i];
					html += '<a href="<%=basePath%>/ls/interest/course/signCourseDetail/'+itm.id+'" class="weui_media_box weui_media_appmsg">';
			    	html += '<div class="weui_media_hd weui_media_hd80">';
			    	if(itm.mainImg) {
			    		html += '<img class="weui_media_appmsg_thumb weui_media_img80" src="'+imgUrl + itm.mainImg+'">';
			    	}else {
			    		html += '<img class="weui_media_appmsg_thumb weui_media_img80" src="<%=basePath%>/images/xqkt_default.png"/>';
			    	}
				    html += '</div><div class="weui_media_bd">';
			        html += '<h4 class="weui_media_title">'+itm.courseNo+""+itm.courseName+'</h4>';
			        html += '<p class="weui_media_desc">人数统计:';
			        for(var j in itm.signCountList) {
			        	var jtm = itm.signCountList[j];
			        	html +=  '<span class="pl10">'+jtm.signClassDate + ' ' + jtm.studentSignCount + '/' + jtm.limitNum +'</span>';
			        	if(j < itm.signCountList.length-1) {
			        		html += ',';
			        	}
			        }
			        html += '</p><p class="weui_media_desc pt5">'+itm.courseDesc+'</p>';
			        html += '</div></a>';
			        
				}
				$("#courseList").append(html);
			}
		});
	}
</script>
</html>